projects
/
emacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
421220e
)
Avoid rounding error in image rotation
author
YAMAMOTO Mitsuharu
<mituharu@math.s.chiba-u.ac.jp>
Mon, 17 Jun 2019 01:43:31 +0000
(10:43 +0900)
committer
YAMAMOTO Mitsuharu
<mituharu@math.s.chiba-u.ac.jp>
Mon, 17 Jun 2019 01:43:31 +0000
(10:43 +0900)
* src/image.c (image_set_rotation): Halve translations as double values.
src/image.c
patch
|
blob
|
history
diff --git
a/src/image.c
b/src/image.c
index a3747cfa6b75b4647b788ef641a375e7ce62f1ad..c08b898e7d8da959aeed5bc4151b7083f8dd8b3a 100644
(file)
--- a/
src/image.c
+++ b/
src/image.c
@@
-2139,7
+2139,7
@@
image_set_rotation (struct image *img, matrix3x3 tm)
matrix3x3 t
= { [0][0] = 1,
[1][1] = 1,
- [2][0] = img->width
>> 1, [2][1] = img->height >> 1
, [2][2] = 1 };
+ [2][0] = img->width
* .5, [2][1] = img->height * .5
, [2][2] = 1 };
matrix3x3 tmp;
matrix3x3_mult (t, tm, tmp);
@@
-2151,8
+2151,8
@@
image_set_rotation (struct image *img, matrix3x3 tm)
matrix3x3_mult (rot, tmp, tmp2);
/* Translate back. */
- t[2][0] = - (width
>> 1
);
- t[2][1] = - (height
>> 1
);
+ t[2][0] = - (width
* .5
);
+ t[2][1] = - (height
* .5
);
matrix3x3_mult (t, tmp2, tm);
img->width = width;